Skip to content

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Oct 15, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Adds a centralized constraint system for ramps, updates request/types to require wallet and use crypto asset structs, and updates providers to honor constraints with minor payment-type fixes.

  • Ramps (Core):
    • Constraint System: Add rampConstraints.ts and utils/constraintUtils.ts with validateRampCheckSupportRequest/validateRampQuoteRequest for global, per-payment rules (ACH/Venmo region limits, Revolut/PayPal country lists, Paybis restrictions).
    • Types: Update rampPluginTypes.ts:
      • Introduce CryptoAsset and use in RampCheckSupportRequest.cryptoAsset.
      • Make RampQuoteRequest.wallet required; remove reliance on request.pluginId for currency plugin id.
  • Providers:
    • Banxa, Moonpay, Paybis, Revolut, Simplex: pre-check support and per-quote constraints; derive currency pluginId from request.wallet.currencyInfo.pluginId; minor address access fixes.
    • Moonpay/Revolut: integrate constraint pre-checks; adjust Venmo handling via constraints; fix wallet address fetching.
    • Paybis: replace iach with ach in allowed/payment maps; update method maps; apply constraint checks; remove US sell credit filter (handled by constraints).
    • Simplex: include platform-specific payment types (applepay/googlepay) and return multiple quotes; add constraint checks; import Platform.
  • UI:
    • RampSelectOptionScene: pass correct crypto plugin id from wallet.currencyInfo.pluginId; remove non-null wallet assertion in approve.
  • GUI Types:
    • fiatPluginTypes.ts: deprecate iach (use ach).

Written by Cursor Bugbot for commit 3c951df. This will update automatically on new commits. Configure here.


@samholmes samholmes force-pushed the sam/ramp-constraints branch from c937925 to 63411e6 Compare October 15, 2025 00:03
cursor[bot]

This comment was marked as outdated.

@samholmes samholmes force-pushed the sam/ramp-constraints branch 2 times, most recently from 6f5eed7 to 6c9b34c Compare October 16, 2025 18:11
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One logic bug, but nice architecture.

// Filter out credit for sell in US for Paybis
if (params.rampPluginId === 'paybis' && params.direction === 'sell') {
yield params.regionCode.countryCode === 'US'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it would be clearer as:

const isUsCredit =
  direction === 'sell' &&
  regionCode.countryCode === 'US' &&
  params.paymentType === 'credit'
yield !isUsCredit

Which by DeMorgan's law could also be written:

yield direction !== 'sell' ||
  regionCode.countryCode !== 'US' ||
  params.paymentType !== 'credit'

It's close to what you have, but with || instead of &&. Still, I feel like this inverted version is harder to understand.

@samholmes samholmes force-pushed the sam/ramp-constraints branch from 6c9b34c to 39244b9 Compare October 16, 2025 20:49
@samholmes samholmes force-pushed the sam/ramp-constraints branch from 39244b9 to 59a12db Compare October 16, 2025 20:59
@samholmes samholmes enabled auto-merge October 16, 2025 20:59
Require `wallet` and use `currencyInfo` to get the `pluginId`.
We're removing `iach` from ramp plugin implementation and deprecating
the value for documentation purposes.

We'll remove the value variant completely when it's no longer a
dependency for legacy code.
We need generators to not early exit on constraints so they're all
applied. This is nice so we don't need to couple our constraints to
other constrains when adding/removing. The contract is that all
the constraints will get equal chance of being applied.
The list of supported countries is copied from the `buyPluginList.json`
file. Revolut is not supported for sell direction, so no need to get
the country codes from `sellPluginList.json`.
This was missing from the paybisProvider implementation.
The list of supported countries is copied from the `buyPluginList.json`
and `sellPluginList.json`.
This may be a temporary constraint, but Paybis does not support sell
now.
@samholmes samholmes force-pushed the sam/ramp-constraints branch from 59a12db to 3c951df Compare October 16, 2025 21:32
await request.wallet?.getAddresses({ tokenId: null })
)?.[0]?.publicAddress
await request.wallet.getAddresses({ tokenId: null })
)[0].publicAddress
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Optional Chaining Removal Causes Runtime Error

Removing optional chaining from the getAddresses() result introduces a potential runtime error. If getAddresses() returns an empty array, accessing [0].publicAddress attempts to read publicAddress from undefined, causing a runtime error. The prior implementation safely returned undefined in this scenario.

Fix in Cursor Fix in Web

@samholmes samholmes merged commit 2a91950 into develop Oct 16, 2025
3 checks passed
@samholmes samholmes deleted the sam/ramp-constraints branch October 16, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants